//方法的值传递
//夏梓豪
//2023/04/01

package code_fangfadesangelianxi;

public class test2 {
    public static void main(String[] args) {
        int[] arr = {10,20,30};
        int number = 100;
        System.out.println("调用change方法前"+number);//100
        number = change(number);//只有这样才能改外面的值
        System.out.println("调用change方法后"+number);//200

        System.out.println("调用change方法后的数组"+arr[1]);
        change(arr);
        System.out.println("调用change方法后的数组"+arr[1]);


    }

    public static int change(int number) {
        number = 200;
        return number;
    }

    public static void change(int[] arr) {
        arr[1] = 200;
    }
}



